home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 May: Tool Chest / Developer CD Series Tool Chest (Apple Computer)(May 1999).iso / Tool Chest / Games / Game Sample Code / ZAM 1.0a13 / CoreSource / AEventCoreDisp.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-09-16  |  1.4 KB  |  70 lines  |  [TEXT/KAHL]

  1.  
  2. #include "CoreGlobals.h"
  3.  
  4.  
  5. pascal OSErr AEOpenApp( AppleEvent *theAE, AppleEvent *reply, long rfCon)
  6. {
  7.     return noErr;
  8. }
  9.  
  10. pascal OSErr AEOpenDoc( AppleEvent  *theAE, AppleEvent  *reply, long  rfCon)
  11. {
  12.     return errAEEventNotHandled;
  13. }
  14.  
  15.  
  16. pascal OSErr AEPrintDoc( AppleEvent  *theAE, AppleEvent  *reply, long  rfCon)
  17. {
  18.     return errAEEventNotHandled;
  19. }
  20.  
  21.  
  22. pascal OSErr AEQuitApp( AppleEvent  *theAE, AppleEvent  *reply, long  rfCon)
  23. {
  24.     gDone = true;        /* set flag to indicate that program should quit */    
  25.     return noErr;
  26. }
  27.  
  28. void DoHighLevelEvent(EventRecord *evt)
  29. {
  30.     short    err;
  31.     
  32.     err = AEProcessAppleEvent(evt);
  33.     if(err)
  34.     {
  35.         ErrMsgCode("\pError processing Apple Event in DoHighLevelEvent",err);
  36.     }
  37. }
  38.  
  39. void InstallAppleEvents(void)
  40. {
  41.     short    err;
  42.  
  43.     err = AEInstallEventHandler (kCoreEventClass, kAEOpenApplication, AEOpenApp,0,FALSE);
  44.     if(err)
  45.     {
  46.         ErrMsgCode("\pCould not install AE handler.",err);
  47.         ExitToShell();
  48.     }
  49.     
  50.     err = AEInstallEventHandler (kCoreEventClass, kAEOpenDocuments, AEOpenDoc,0,FALSE);
  51.     if(err)
  52.     {
  53.         ErrMsgCode("\pCould not install AE handler.",err);
  54.         ExitToShell();
  55.     }
  56.         
  57.     err = AEInstallEventHandler (kCoreEventClass, kAEPrintDocuments, AEPrintDoc,0,FALSE);
  58.     if(err)
  59.     {
  60.         ErrMsgCode("\pCould not install AE handler.",err);
  61.         ExitToShell();
  62.     }
  63.     err = AEInstallEventHandler (kCoreEventClass, kAEQuitApplication, AEQuitApp,0,FALSE);
  64.     if(err)
  65.     {
  66.         ErrMsgCode("\pCould not install AE handler.",err);
  67.         ExitToShell();
  68.     }
  69.  
  70. }